package com.doublethread.easymart.common.exception;

import com.doublethread.easymart.common.result.ResultCode;

/**
 * 订单模块异常工具类
 */
public class OrderException {

    /**
     * 订单不存在异常
     */
    public static void orderNotFound() {
        throw new BusinessException(ResultCode.ORDER_NOT_FOUND);
    }

    /**
     * 订单状态错误异常
     */
    public static void orderStatusError() {
        throw new BusinessException(ResultCode.ORDER_STATUS_ERROR);
    }

    /**
     * 购物车为空异常
     */
    public static void cartEmpty() {
        throw new BusinessException(ResultCode.CART_EMPTY);
    }

    /**
     * 购物车商品不存在异常
     */
    public static void cartItemNotFound() {
        throw new BusinessException(ResultCode.CART_ITEM_NOT_FOUND);
    }

    /**
     * 订单无法取消异常
     */
    public static void orderCannotCancel() {
        throw new BusinessException(ResultCode.ORDER_CANNOT_CANCEL);
    }

    /**
     * 订单已支付异常
     */
    public static void orderAlreadyPaid() {
        throw new BusinessException(ResultCode.ORDER_ALREADY_PAID);
    }

    /**
     * 订单已过期异常
     */
    public static void orderExpired() {
        throw new BusinessException(ResultCode.ORDER_EXPIRED);
    }

    /**
     * 商品已在购物车中异常
     */
    public static void cartItemExists() {
        throw new BusinessException(ResultCode.CART_ITEM_EXISTS);
    }

    /**
     * 订单无法支付异常
     */
    public static void orderCannotPay() {
        throw new BusinessException(ResultCode.ORDER_STATUS_ERROR);
    }

    /**
     * 订单无法确认收货异常
     */
    public static void orderCannotReceive() {
        throw new BusinessException(ResultCode.ORDER_STATUS_ERROR);
    }

    /**
     * 订单无法发货异常
     */
    public static void orderCannotDeliver() {
        throw new BusinessException(ResultCode.ORDER_STATUS_ERROR);
    }
}